package com.exmaple.excel.jxls;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 机构清算查询
 *
 * @author LiuShengPei
 * @date 2017/12/19 15:23
 */
@Controller
@RequestMapping("/third/")
public class KpayInfcasinfController {
    private static Logger log = LoggerFactory.getLogger(KpayInfcasinfController.class);

//    @Autowired
//    private KpayInfcasinfService kpayInfcasinfService;
//    @Autowired
//    private KpayDownInfoService kpayDownInfoService;
//
//    @Value("#{mpmngConfig}")
//    private Properties prop;
//
//
//    /**
//     * 机构清算查询导出 by mxl
//     * @param request
//     * @param searchMap
//     * @param session
//     * @param response
//     * @return
//     */
//    @RequestMapping({"kpayInfcasinfListUpload"})
//    public String kpayInfcasinfListUpload(HttpServletRequest request, @RequestParam Map<String ,Object> searchMap, HttpSession session, HttpServletResponse response) {
//        String startDate = searchMap.get("STARTORDERDATE") == null ? "" : searchMap.get("STARTORDERDATE").toString();
//        String endDate = searchMap.get("ENDORDERDATE") == null ? "" : searchMap.get("ENDORDERDATE").toString();
//        if (startDate != "") {
//            startDate = TdExpBasicFunctions.FMTTIME(startDate,
//                    "yyyy-MM-dd", "yyyyMMdd");
//        }else{
//            SimpleDateFormat format=new SimpleDateFormat("yyyyMMdd");
//            String date=format.format(new Date());
//            startDate=date;
//        }
//        if (endDate != "") {
//            endDate = TdExpBasicFunctions.FMTTIME(endDate,
//                    "yyyy-MM-dd", "yyyyMMdd");
//        }else{
//            SimpleDateFormat format=new SimpleDateFormat("yyyyMMdd");
//            String date=format.format(new Date());
//            endDate=date;
//        }
//        searchMap.put("STARTORDERDATE", startDate);
//        searchMap.put("ENDORDERDATE", endDate);
//        HashMap<String, Object> result = new HashMap<String, Object>();
//
//        log.debug("查询参数:{}", searchMap);
//        String dateTime = TdExpBasicFunctions.GETDATETIME();
//        List<Map<String,Object>> uploadList=null;
//        try {
//            uploadList = kpayInfcasinfService.findListPageExport(searchMap);
//            if(uploadList==null ){
//                log.info("没有可导出的数据！");
//            } else if(uploadList.size() <= 0){
//                log.info("没有可导出的数据！");
//            }
//        } catch (Exception e) {
//            log.error(e.getMessage());
//        }
//        ExcelUtilForJxls ex = new ExcelUtilForJxls();
//        //模版名称
//        String templetName="kpayInfCasInf.xlsx";
//        //导出文件名称
//        String exportFileName="kPayInfCasInfPayReport"+dateTime+".xlsx";
//        response.setHeader("Content-Disposition", "attachment; filename="+exportFileName);
//        /**
//         * 模板路径
//         * TEMPLET_FILE=WEB-INF/classes/omng/conf-omng/exportTemplate/
//         */
//        String templetFilePath =request.getServletContext().getRealPath("/")+String.valueOf(this.prop.get("TEMPLET_FILE"));
//        //导出保存路径
//        String exportFilePath =String.valueOf(this.prop.get("FILE_UPLOAD"));
//        exportFilePath =exportFilePath+String.valueOf(this.prop.get("PAY_FILE_DOWNLOAD"))+dateTime.substring(0, 6)+"/"+dateTime.substring(6, 8)+"/";
//        log.info("导出文件保存路径：", exportFilePath);
//        try {
//            //调用导出方法示例
//            int num=ex.exportExcel(templetFilePath,templetName,exportFilePath,exportFileName,"",uploadList,response);
//            if(num!=0){
//                log.error("机构清算导出异常！");
//            }
//        } catch (Exception e) {
//            log.error("机构清算导出异常！", e);
//        }
//        return null;
//    }


}
